package com.atguigu.lease.admin.interceptor;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
public class WebAdminMvcConfig implements WebMvcConfigurer {
    @Autowired
    WebAdminAuthInterceptor webAdminAuthInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(webAdminAuthInterceptor)
                //拦截路径表达式
        .addPathPatterns("/admin/**")
                //放行路径的表达式
        .excludePathPatterns("/admin/login","/admin/login/captcha");
        //如果上面的表达式没有匹配的路径，拦截器不会拦截
    }


}
